package com.warehouse.module.system.dal.mysql.appuser;

import java.util.*;

import com.warehouse.framework.common.pojo.PageResult;
import com.warehouse.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.warehouse.framework.mybatis.core.mapper.BaseMapperX;
import com.warehouse.module.system.dal.dataobject.appuser.AppUserDO;
import org.apache.ibatis.annotations.Mapper;
import com.warehouse.module.system.controller.admin.appuser.vo.*;

/**
 * APP用户 Mapper
 *
 * @author Eric
 */
@Mapper
public interface AppUserMapper extends BaseMapperX<AppUserDO> {

    default PageResult<AppUserDO> selectPage(AppUserPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AppUserDO>()
                .betweenIfPresent(AppUserDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(AppUserDO::getNickName, reqVO.getNickName())
                .eqIfPresent(AppUserDO::getPhoneNumber, reqVO.getPhoneNumber())
                .eqIfPresent(AppUserDO::getHeadImageUrl, reqVO.getHeadImageUrl())
                .eqIfPresent(AppUserDO::getMpUserId, reqVO.getMpUserId())
                .eqIfPresent(AppUserDO::getCompanyId, reqVO.getCompanyId())
                .eqIfPresent(AppUserDO::getAppId, reqVO.getAppId())
                .eqIfPresent(AppUserDO::getAccountId, reqVO.getAccountId())
                .orderByDesc(AppUserDO::getId));
    }

}